<template>
  <div>
    <component :is="currentView" :isPreview="isPreview" :config="config" ref="divModel" v-show="showPage"></component>
  </div>
</template>

<script>
import DevFormServiceApi from "@/service/dev/DevFormService";

export default {
  data() {
    return {
      currentView: '',
      isPreview:false,
      showPage: false,
      config: {},
      id: ''
    }
  },
  created() {
    this.init()
  },
  methods: {
    async init() {
      this.id = this.$route.query.id;
      this.isPreview = this.$route.query.isPreview || false;
      let params = {
        id: this.id,
      };
      let result = await DevFormServiceApi.queryById(params);
      this.config = result.data
      if(this.config.state === 1){
        this.currentView = 'formModel'
      }else {
        this.currentView = 'dynamicModel'
      }
      this.showPage = true;
      // this.$refs.divModel.init(this.config);

    }
  },
}
</script>

<style>
#container{
  padding:20px;
}
  .footer{
    margin-left:100px;
  }
</style>